home *** CD-ROM | disk | FTP | other *** search
- PAGE 60, 132
- TITLE Testing the TSR graphics interupt
-
-
- CSEG SEGMENT
-
- ORG 100H
- ASSUME CS:CSEG, DS:CSEG, SS:CSEG
-
- START: MOV AH, 7 ; fn to get a key
- INT 21h ; DOS int call
-
- CMP AL, 27 ; check to see if they hit the <Esc> key
- JNE OKsofar ; if so, get out
- JMP DONE
-
- OKsofar: CMP AL, 30h ; check to see if the key hit was 0
- JA Maybe ; if so, get out
- JB START ; if less than even that, try again
- JMP DONE
-
- Maybe: CMP AL, 37h ; check it against the 7 key
- JA START ; if higher than that, try again
-
-
- ; +----------------------------------------------+
- ; | the only way to get to this point is if the |
- ; | key hit was a number key between 1 and 7. |
- ; +----------------------------------------------+
-
- CMP AL, 32h ; check to see if a 2 was hit
- JB Turn_on_gr ; if less than that, it was the # 1
- JE Turn_on_text ; if equal . . .
-
- CMP AL, 34h ; compare the input to 4
- JB Draw_pts ; if less than that, it was 3 (1&2 above)
- JE Draw_lines ; if equal . . .
-
- CMP AL, 36h ; compare it to 6
- JB Set_active_pg_int ; if below, 5
- JE Clear_the_pg_int ; if equal, 6
- JA Fill_the_pg_int ; if above, 7
-
-
- Set_active_pg_int:
- JMP Set_active_pg
-
- Clear_the_pg_int:
- JMP Clear_the_pg
-
- Fill_the_pg_int:
- JMP Fill_the_pg
-
-
-
- Turn_on_gr:
- MOV AH, 7 ; get a number for the page
- INT 21h
-
- CMP AL, 31h ; is it too high or too low
- JA Turn_on_gr
- CMP AL, 30h
- JB Turn_on_gr
-
- AND AL, 1 ; mask off low bit
- OR AL, 10h ; make AL the INT 70h fn to turn on gr
-
- LEA BX, misc ; get address for misc data area
- MOV [BX], AL ; move gr on fn to there
- XOR AL, AL ; clear byte
- MOV [BX + 1], AL ; tell interupt when to stop
- MOV AX, DS ; get segment for interupt call
- INT 70h ; call interupt
- JMP START ; you're done
-
-
- Turn_on_text:
- MOV AH, 7 ; get a number for the page
- INT 21h
-
- CMP AL, 31h ; is it too high or too low
- JA Turn_on_text
- CMP AL, 30h
- JB Turn_on_text
-
- AND AL, 1 ; mask off low bit
- OR AL, 20h ; make AL the INT 70h fn to turn on text
-
- LEA BX, misc ; get address for misc data area
- MOV [BX], AL ; move text on fn to there
- XOR AL, AL ; clear byte
- MOV [BX + 1], AL ; tell interupt when to stop
- MOV AX, DS ; get segment for interupt call
- INT 70h ; call interupt
- JMP START ; you're done
-
-
-
- Draw_pts:
- MOV AX, DS
- LEA BX, Points
- INT 70h
- JMP START
-
-
-
- Draw_lines:
- MOV AX, DS ; setup for INT 70h: get the segment and
- LEA BX, Lines ; offset of the data
- INT 70H ; call graphics interupt
- CMP AH, 0FFh
- JZ DONE
-
- JMP START
-
-
- Set_active_pg:
- MOV AH, 7 ; get a number for the page
- INT 21h
-
- CMP AL, 31h ; is it too high or too low
- JA Set_active_pg
- CMP AL, 30h
- JB Set_active_pg
-
- AND AL, 1 ; mask off low bit
- OR AL, 50h ; make AL the INT 70h fn to set active pg
-
- LEA BX, misc ; get address for misc data area
- MOV [BX], AL ; move set active pg fn to there
- XOR AL, AL ; clear byte
- MOV [BX + 1], AL ; tell interupt when to stop
- MOV AX, DS ; get segment for interupt call
- INT 70h ; call interupt
- JMP START ; you're done
-
-
-
-
- Clear_the_pg:
- MOV AH, 7 ; get a number for the page
- INT 21h
-
- CMP AL, 31h ; is it too high or too low
- JA Clear_the_pg
- CMP AL, 30h
- JB Clear_the_pg
-
- AND AL, 1 ; mask off low bit
- OR AL, 60h ; make AL the INT 70h fn to Clear the pg
-
- LEA BX, misc ; get address for misc data area
- MOV [BX], AL ; move clear the pg fn to there
- XOR AL, AL ; clear byte
- MOV [BX + 1], AL ; tell interupt when to stop
- MOV AX, DS ; get segment for interupt call
- INT 70h ; call interupt
- JMP START ; you're done
-
-
-
-
- Fill_the_pg:
- MOV AH, 7 ; get a number for the page
- INT 21h
-
- CMP AL, 31h ; is it too high or too low
- JA Fill_the_pg
- CMP AL, 30h
- JB Fill_the_pg
-
- AND AL, 1 ; mask off low bit
- OR AL, 70h ; make AL the INT 70h fn to Fill the pg
-
- LEA BX, misc ; get address for misc data area
- MOV [BX], AL ; move fill the pg fn to there
-
- MOV AH, 7 ; get a number to fill the page with
- INT 21h
-
- MOV AH, AL ; since 2 bytes are used, copy given byte
- MOV [BX+1], AX ; store the value in memory
-
- XOR AL, AL ; clear byte
- MOV [BX + 3], AL ; tell interupt when to stop
- MOV AX, DS ; get segment for interupt call
- INT 70h ; call interupt
- JMP START ; you're done
-
-
-
-
-
- DONE: MOV AX, CS ; setupt for INT 70h
- LEA BX, Reset
- INT 70H ; call graphics interupt
-
- INT 20H ; stop this program
-
-
- misc DB 00
- DW 0000
- DW 0000
-
-
- Gr_on DB 11h ; turn on graphics
- DB 61h ; clear page 1
- DB 51h ; set active page to 1
- DB 00
-
-
- Points DB 32h ; plot a point
- DW 9, 140
- DB 32h ; plot a point
- DW 10, 140
- DB 32h
- DW 11, 140
- DB 32h ; plot a point
- DW 9, 141
- DB 32h ; plot a point
- DW 10, 141
- DB 32h
- DW 11, 141
-
- DB 32h ; plot a point
- DW 39, 170
- DB 32h ; plot a point
- DW 40, 170
- DB 32h
- DW 41, 170
- DB 32h ; plot a point
- DW 39, 171
- DB 32h ; plot a point
- DW 40, 171
- DB 32h
- DW 41, 171
-
- DB 32h ; plot a point
- DW 9, 200
- DB 32h ; plot a point
- DW 10, 200
- DB 32h ; plot a point
- DW 11, 200
- DB 32h ; plot a point
- DW 9, 201
- DB 32h ; plot a point
- DW 10, 201
- DB 32h ; plot a point
- DW 11, 201
-
- DB 32h ; plot a point
- DW 689, 140
- DB 32h ; plot a point
- DW 690, 140
- DB 32h ; plot a point
- DW 691, 140
- DB 32h ; plot a point
- DW 689, 141
- DB 32h ; plot a point
- DW 690, 141
- DB 32h ; plot a point
- DW 691, 141
-
- DB 32h ; plot a point
- DW 659, 170
- DB 32h ; plot a point
- DW 660, 170
- DB 32h ; plot a point
- DW 661, 170
- DB 32h ; plot a point
- DW 659, 171
- DB 32h ; plot a point
- DW 660, 171
- DB 32h ; plot a point
- DW 661, 171
-
- DB 32h ; plot a point
- DW 689, 200
- DB 32h ; plot a point
- DW 690, 200
- DB 32h ; plot a point
- DW 691, 200
- DB 32h ; plot a point
- DW 689, 201
- DB 32h ; plot a point
- DW 690, 201
- DB 32h ; plot a point
- DW 691, 201
- DB 00
-
-
- Lines DB 42h ; draw a line (XOR)
- DW 0, 0, 700, 340
- DB 42h ; draw a line (XOR)
- DW 10, 0, 690, 340
- DB 42h ; draw a line (XOR)
- DW 20, 0, 680, 340
- DB 42h ; draw a line (XOR)
- DW 30, 0, 670, 340
- DB 42h ; draw a line (XOR)
- DW 40, 0, 660, 340
- DB 42h ; draw a line (XOR)
- DW 50, 0, 650, 340
- DB 42h ; draw a line (XOR)
- DW 60, 0, 640, 340
- DB 42h ; draw a line (XOR)
- DW 70, 0, 630, 340
- DB 42h ; draw a line (XOR)
- DW 80, 0, 620, 340
- DB 42h ; draw a line (XOR)
- DW 90, 0, 610, 340
-
- DB 42h ; draw a line (XOR)
- DW 100, 0, 600, 340
- DB 42h ; draw a line (XOR)
- DW 110, 0, 590, 340
- DB 42h ; draw a line (XOR)
- DW 120, 0, 580, 340
- DB 42h ; draw a line (XOR)
- DW 130, 0, 570, 340
- DB 42h ; draw a line (XOR)
- DW 140, 0, 560, 340
- DB 42h ; draw a line (XOR)
- DW 150, 0, 550, 340
- DB 42h ; draw a line (XOR)
- DW 160, 0, 540, 340
- DB 42h ; draw a line (XOR)
- DW 170, 0, 530, 340
- DB 42h ; draw a line (XOR)
- DW 180, 0, 520, 340
- DB 42h ; draw a line (XOR)
- DW 190, 0, 510, 340
-
- DB 42h ; draw a line (XOR)
- DW 200, 0, 500, 340
- DB 42h ; draw a line (XOR)
- DW 210, 0, 490, 340
- DB 42h ; draw a line (XOR)
- DW 220, 0, 480, 340
- DB 42h ; draw a line (XOR)
- DW 230, 0, 470, 340
- DB 42h ; draw a line (XOR)
- DW 240, 0, 460, 340
- DB 42h ; draw a line (XOR)
- DW 250, 0, 450, 340
- DB 42h ; draw a line (XOR)
- DW 260, 0, 440, 340
- DB 42h ; draw a line (XOR)
- DW 270, 0, 430, 340
- DB 42h ; draw a line (XOR)
- DW 280, 0, 420, 340
- DB 42h ; draw a line (XOR)
- DW 290, 0, 410, 340
-
- DB 42h ; draw a line (XOR)
- DW 300, 0, 400, 340
- DB 42h ; draw a line (XOR)
- DW 310, 0, 390, 340
- DB 42h ; draw a line (XOR)
- DW 320, 0, 380, 340
- DB 42h ; draw a line (XOR)
- DW 330, 0, 370, 340
- DB 42h ; draw a line (XOR)
- DW 340, 0, 360, 340
- DB 42h ; draw a line (XOR)
- DW 350, 0, 350, 340
- DB 42h ; draw a line (XOR)
- DW 360, 0, 340, 340
- DB 42h ; draw a line (XOR)
- DW 370, 0, 330, 340
- DB 42h ; draw a line (XOR)
- DW 380, 0, 320, 340
- DB 42h ; draw a line (XOR)
- DW 390, 0, 310, 340
-
- DB 42h ; draw a line (XOR)
- DW 400, 0, 300, 340
- DB 42h ; draw a line (XOR)
- DW 410, 0, 290, 340
- DB 42h ; draw a line (XOR)
- DW 420, 0, 280, 340
- DB 42h ; draw a line (XOR)
- DW 430, 0, 270, 340
- DB 42h ; draw a line (XOR)
- DW 440, 0, 260, 340
- DB 42h ; draw a line (XOR)
- DW 450, 0, 250, 340
- DB 42h ; draw a line (XOR)
- DW 460, 0, 240, 340
- DB 42h ; draw a line (XOR)
- DW 470, 0, 230, 340
- DB 42h ; draw a line (XOR)
- DW 480, 0, 220, 340
- DB 42h ; draw a line (XOR)
- DW 490, 0, 210, 340
-
- DB 42h ; draw a line (XOR)
- DW 500, 0, 200, 340
- DB 42h ; draw a line (XOR)
- DW 510, 0, 190, 340
- DB 42h ; draw a line (XOR)
- DW 520, 0, 180, 340
- DB 42h ; draw a line (XOR)
- DW 530, 0, 170, 340
- DB 42h ; draw a line (XOR)
- DW 540, 0, 160, 340
- DB 42h ; draw a line (XOR)
- DW 550, 0, 150, 340
- DB 42h ; draw a line (XOR)
- DW 560, 0, 140, 340
- DB 42h ; draw a line (XOR)
- DW 570, 0, 130, 340
- DB 42h ; draw a line (XOR)
- DW 580, 0, 120, 340
- DB 42h ; draw a line (XOR)
- DW 590, 0, 110, 340
-
- DB 42h ; draw a line (XOR)
- DW 600, 0, 100, 340
- DB 42h ; draw a line (XOR)
- DW 610, 0, 90, 340
- DB 42h ; draw a line (XOR)
- DW 620, 0, 80, 340
- DB 42h ; draw a line (XOR)
- DW 630, 0, 70, 340
- DB 42h ; draw a line (XOR)
- DW 640, 0, 60, 340
- DB 42h ; draw a line (XOR)
- DW 650, 0, 50, 340
- DB 42h ; draw a line (XOR)
- DW 660, 0, 40, 340
- DB 42h ; draw a line (XOR)
- DW 670, 0, 30, 340
- DB 42h ; draw a line (XOR)
- DW 680, 0, 20, 340
- DB 42h ; draw a line (XOR)
- DW 690, 0, 10, 340
- DB 42h ; draw a line (XOR)
- DW 700, 0, 0, 340
-
- ;---------------------- SECOND SET OF LINES ----------------------
-
- DB 42h ; draw a line (XOR)
- DW 5, 0, 695, 340
- DB 42h ; draw a line (XOR)
- DW 15, 0, 685, 340
- DB 42h ; draw a line (XOR)
- DW 25, 0, 675, 340
- DB 42h ; draw a line (XOR)
- DW 35, 0, 665, 340
- DB 42h ; draw a line (XOR)
- DW 45, 0, 655, 340
- DB 42h ; draw a line (XOR)
- DW 55, 0, 645, 340
- DB 42h ; draw a line (XOR)
- DW 65, 0, 635, 340
- DB 42h ; draw a line (XOR)
- DW 75, 0, 625, 340
- DB 42h ; draw a line (XOR)
- DW 85, 0, 615, 340
- DB 42h ; draw a line (XOR)
- DW 95, 0, 605, 340
-
- DB 42h ; draw a line (XOR)
- DW 105, 0, 595, 340
- DB 42h ; draw a line (XOR)
- DW 115, 0, 585, 340
- DB 42h ; draw a line (XOR)
- DW 125, 0, 575, 340
- DB 42h ; draw a line (XOR)
- DW 135, 0, 565, 340
- DB 42h ; draw a line (XOR)
- DW 145, 0, 555, 340
- DB 42h ; draw a line (XOR)
- DW 155, 0, 545, 340
- DB 42h ; draw a line (XOR)
- DW 165, 0, 535, 340
- DB 42h ; draw a line (XOR)
- DW 175, 0, 525, 340
- DB 42h ; draw a line (XOR)
- DW 185, 0, 515, 340
- DB 42h ; draw a line (XOR)
- DW 195, 0, 505, 340
-
- DB 42h ; draw a line (XOR)
- DW 205, 0, 495, 340
- DB 42h ; draw a line (XOR)
- DW 215, 0, 485, 340
- DB 42h ; draw a line (XOR)
- DW 225, 0, 475, 340
- DB 42h ; draw a line (XOR)
- DW 235, 0, 465, 340
- DB 42h ; draw a line (XOR)
- DW 245, 0, 455, 340
- DB 42h ; draw a line (XOR)
- DW 255, 0, 445, 340
- DB 42h ; draw a line (XOR)
- DW 265, 0, 435, 340
- DB 42h ; draw a line (XOR)
- DW 275, 0, 425, 340
- DB 42h ; draw a line (XOR)
- DW 285, 0, 415, 340
- DB 42h ; draw a line (XOR)
- DW 295, 0, 405, 340
-
- DB 42h ; draw a line (XOR)
- DW 305, 0, 395, 340
- DB 42h ; draw a line (XOR)
- DW 315, 0, 385, 340
- DB 42h ; draw a line (XOR)
- DW 325, 0, 375, 340
- DB 42h ; draw a line (XOR)
- DW 335, 0, 365, 340
- DB 42h ; draw a line (XOR)
- DW 345, 0, 355, 340
- DB 42h ; draw a line (XOR)
- DW 355, 0, 345, 340
- DB 42h ; draw a line (XOR)
- DW 365, 0, 335, 340
- DB 42h ; draw a line (XOR)
- DW 375, 0, 325, 340
- DB 42h ; draw a line (XOR)
- DW 385, 0, 315, 340
- DB 42h ; draw a line (XOR)
- DW 395, 0, 305, 340
-
- DB 42h ; draw a line (XOR)
- DW 405, 0, 295, 340
- DB 42h ; draw a line (XOR)
- DW 415, 0, 285, 340
- DB 42h ; draw a line (XOR)
- DW 425, 0, 275, 340
- DB 42h ; draw a line (XOR)
- DW 435, 0, 265, 340
- DB 42h ; draw a line (XOR)
- DW 445, 0, 255, 340
- DB 42h ; draw a line (XOR)
- DW 455, 0, 245, 340
- DB 42h ; draw a line (XOR)
- DW 465, 0, 235, 340
- DB 42h ; draw a line (XOR)
- DW 475, 0, 225, 340
- DB 42h ; draw a line (XOR)
- DW 485, 0, 215, 340
- DB 42h ; draw a line (XOR)
- DW 495, 0, 205, 340
-
- DB 42h ; draw a line (XOR)
- DW 505, 0, 195, 340
- DB 42h ; draw a line (XOR)
- DW 515, 0, 185, 340
- DB 42h ; draw a line (XOR)
- DW 525, 0, 175, 340
- DB 42h ; draw a line (XOR)
- DW 535, 0, 165, 340
- DB 42h ; draw a line (XOR)
- DW 545, 0, 155, 340
- DB 42h ; draw a line (XOR)
- DW 555, 0, 145, 340
- DB 42h ; draw a line (XOR)
- DW 565, 0, 135, 340
- DB 42h ; draw a line (XOR)
- DW 575, 0, 125, 340
- DB 42h ; draw a line (XOR)
- DW 585, 0, 115, 340
- DB 42h ; draw a line (XOR)
- DW 595, 0, 105, 340
-
- DB 42h ; draw a line (XOR)
- DW 605, 0, 95, 340
- DB 42h ; draw a line (XOR)
- DW 615, 0, 85, 340
- DB 42h ; draw a line (XOR)
- DW 625, 0, 75, 340
- DB 42h ; draw a line (XOR)
- DW 635, 0, 65, 340
- DB 42h ; draw a line (XOR)
- DW 645, 0, 55, 340
- DB 42h ; draw a line (XOR)
- DW 655, 0, 45, 340
- DB 42h ; draw a line (XOR)
- DW 665, 0, 35, 340
- DB 42h ; draw a line (XOR)
- DW 675, 0, 25, 340
- DB 42h ; draw a line (XOR)
- DW 685, 0, 15, 340
- DB 42h ; draw a line (XOR)
- DW 695, 0, 5, 340
-
- DB 00 ; end interupt code
-
- Reset DB 20h ; text on (page 0)
-
- DB 70h ; fill the given buffer with...
- DB 32, 7 ; spaces with normal attributes
-
- DB 00 ; end interupt code
-
- CSEG ENDS
- END START
- END